package org.jix.weblog.module.common.domain.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jix.weblog.module.common.domain.dos.CategoryDO;

/**
 * @version 1.0
 * @Author Jix
 * @Date 2024/7/30 9:40
 * @注释
 */


public interface CategoryMapper extends BaseMapper<CategoryDO> {

    /**
     * 根据用户名查询
     * @param categoryName
     * @return
     */
    default CategoryDO selectByName(String categoryName) {
        //查询条件--获取用户名
        LambdaQueryWrapper<CategoryDO> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CategoryDO::getName, categoryName);
        //执行查询
        return selectOne(wrapper);
    }
}
